<template>
  <div class="app-container home">
    <el-row :gutter="20">
      <el-col :sm="24" :lg="24">
        <blockquote class="text-warning" style="font-size: 14px">
          欢迎来到手机商城后台管理系统
          <br />
          <br />
          以下是常用功能选区
          <br />
          <br />
          请根据需要快捷操作
        </blockquote>

        <hr />
      </el-col>
    </el-row>
    <el-divider />
    <el-row :gutter="20">
      <el-col>
        <el-card>
          <div slot="header">
            <div class="tip-color"></div>
            <span>常用操作</span>
          </div>
          <div class="simple-op">
            <div>
              <i class="iconfont icon-shangpinguanli"></i><span>商品管理</span>
            </div>
            <div><i class="iconfont icon-fabu"></i><span>发布商品</span></div>
            <div>
              <i class="iconfont icon-dingdanzhongxin"></i><span>订单中心</span>
            </div>
          </div>
        </el-card>
      </el-col>
    </el-row>
    <el-divider />
    <el-row type="flex" justify="space-between">
      <el-col :sm="10" :lg="10" :xl="10">
        <el-card>
          <div slot="header">
            <div class="tip-color"></div>
            <span>图表详细数据</span>
          </div>
          <div ref="chart" style="width:50%;height:376px"></div>
        </el-card>
      </el-col>
      <el-col :sm="10" :lg="10" :xl="10">
        <el-card>
          <div slot="header">
            <div class="tip-color"></div>
            <span>待处理事务</span>
          </div>
        </el-card>
        <el-divider />
        <el-card>
          <div slot="header">
            <div class="tip-color"></div>
            <span>商品</span>
          </div>
        </el-card>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import * as echarts from 'echarts'
require('echarts/theme/macarons') // echarts theme
export default {
  name: "Index",
  data() {
    return {};
  },
  mounted(){
    this.getEchartData();
  },
  methods: {
    goTarget(href) {
      window.open(href, "_blank");
    },
    getEchartData(){
      const chart = this.$refs.chart;
      if(chart){
        const myChart = echarts.init(chart);
          // 指定图表的配置项和数据
        var option = {
          title: {
            text: 'ECharts 入门示例'
          },
          tooltip: {},
          legend: {
            data: ['销量']
          },
          xAxis: {
            data: ['衬衫', '羊毛衫', '雪纺衫', '裤子', '高跟鞋', '袜子']
          },
          yAxis: {},
          series: [
            {
              name: '销量',
              type: 'bar',
              data: [5, 20, 36, 10, 10, 20]
            }
          ]
        };
        myChart.setOption(option)
      }
    }
  },
};
</script>

<style scoped lang="scss">
.home {
  blockquote {
    padding: 10px 20px;
    margin: 0 0 20px;
    font-size: 17.5px;
    border-left: 5px solid #eee;
  }
  hr {
    margin-top: 20px;
    margin-bottom: 20px;
    border: 0;
    border-top: 1px solid #eee;
  }
  span {
    font-size: 25px;
  }
  .el-card {
    div {
      display: flex;
      align-items: center;
    }
    .tip-color {
      display: inline-block;
      width: 10px;
      height: 30px;
      background: linear-gradient(to bottom, #0088ff, #3398df);
      margin-right: 3px;
    }
    .simple-op {
      justify-content: space-around;
      align-items: center;
      div {
        display: flex;
        flex-direction: column;
        cursor: pointer;

        i {
          font-size: 30px;
        }
        span {
          font-size: 20px;
        }
      }
    }
  }

  font-family: "open sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 13px;
  color: #676a6c;
  overflow-x: hidden;
}
</style>
